package com.jlpay.openapi.demo.openmerch.device;

import com.jlpay.open.jlpay.sdk.java.model.openmerch.device.request.DeviceChangeRequest;
import com.jlpay.open.jlpay.sdk.java.model.openmerch.device.response.DeviceChangeResponse;
import com.jlpay.open.jlpay.sdk.java.utils.json.JsonUtils;
import com.jlpay.openapi.demo.JlpayOpenApiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author dengwenning
 * @since 2024/4/24
 **/
public class ChangeService {

    private static final Logger LOGGER = LoggerFactory.getLogger(ChangeService.class);

    public static void main(String[] args) {
        DeviceChangeRequest deviceChangeRequest = buildDeviceChangeRequest();
        DeviceChangeResponse deviceChangeResponse = JlpayOpenApiService.openMerchWithCryptoService()
                .post(deviceChangeRequest, DeviceChangeResponse.class);
        LOGGER.info("换机响应:{}", JsonUtils.toString(deviceChangeResponse));
    }

    private static DeviceChangeRequest buildDeviceChangeRequest(){
        DeviceChangeRequest deviceChangeRequest = new DeviceChangeRequest();

        deviceChangeRequest.setMerchNo("84944035812S123");
        deviceChangeRequest.setTermNo("S1002513");
        deviceChangeRequest.setNewDeviceNo("NS301257964");

        return deviceChangeRequest;
    }
}
